{% extends "BackendBundle:User:layout.html.twig" %}



{% block fos_user_content %}
<link href="{{ asset('css/jquery.validity.css') }}" rel="stylesheet" type="text/css" />

<script src="{{ asset('js/jquery-1.8.2.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/jquery.validity.js') }}" type="text/javascript"></script>
<form action="{{ path('user_resetting_reset', {'token': token}) }}" {{ form_enctype(form) }} method="POST">
    <div class="logo"><img src="{{ asset('images/login/24.png') }}" alt="" />
    </div>
    <div id="block">
        <div class="form">
            <p class="reset-box">&nbsp;</p>
            <div id="resetPassord">
                {% if invalid_username is defined %}
                    <p>Nombre de usuario:</p>
                {% endif %}
                {{ form_widget(form)}}
                </div>
                <div>
                    <input class="btnReset" type="submit" value="Reestablecer Contrase&n&nacute;a" />
                </div>
            {% if error %}
                <div class="divError">
                    <div class="alert alert-error">
                        <a class="close" data-dismiss="alert">×</a>
                        <strong>{{ error.message }}</strong> 
                    </div>
                </div>
            {% endif %} 
                <i class="ctop">&nbsp;</i>
                <i class="cbottom">&nbsp;</i>
            </div>
        </div>
    </form>



    <script type="text/javascript">

        $(".btnReset").on('click', function(){
            return validateAjaxInputs();
        });
        
        function validateAjaxInputs() {
            $.validity.setup({
                outputMode:"modal"                
            });

            $.validity.start();

     
            //validacion campo contraseña
            $("input[type='password']")
            .require("Es obligatorio")
            .match(/^(?=^.{6,}$)((?=.*[A-Za-z0-9]))^.*$/, "La contraseña debe tener al menos 6 caracteres  alfanumericos")
            .equal("Las contraseñas no son iguales."); 
       

            var result = $.validity.end();

            // Return whether it's okay to proceed with the Ajax:
            return result.valid;
        }
        </script>


{% endblock fos_user_content %}

